<?php

namespace App\Jobs;

use App\Services\Orders\OrderService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class AutoOrderCancelQueue implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $order_id;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($order_id)
    {
        $this->order_id=$order_id;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(OrderService $orderService)
    {
        //调用 AutoOrderCancelQueue::dispatch($order_id)->onQueue('AutoOrderCancelQueue')->delay(now()->addMinutes(config('shidexian.auto_order_cancel_time')));
        $orderService->ExecuteAutoOrderCancel($this->order_id);
    }
}
